<?php

class Application_Form_Addsondage extends Zend_Form
{

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
    	
    	$decorators=array(
    			array('ViewHelper', array('tag'   => 'div', "class"=>"controls")),
    			array('Label' , array(  "class"=>"control-label")),
    			'Errors',
    			new Zend_Form_Decorator_HtmlTag(array(
    					'tag'   => 'div', "class"=>"control-group"
    			)
    			)
    	);
    	
    	
    	
    	
    	$titre = new Zend_Form_Element_Text('titre');
    	$titre->setLabel('Titre de Sondage:   ')
    	->setRequired(true)
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty');
    	$titre->setAttrib("title","Titre de sondage qui sera afficher au candidat");
    	$titre->setDecorators($decorators);
    	
    	$mapper= new Application_Model_Mapper_Domaine();
    	$select=$mapper->fetchAllToArray();
    	
    	$tmp=array();
    	$tmp['']="selectionner un domaie";
    	foreach ($select as $key => $value ){
    		$tmp[ $value['iddomaine'] ] = $value['iddomaine'];
    	}
    	$domaineliste = array("multiOptions" => $tmp);
    	
    	$domaines= new Zend_Form_Element_Select('domaine_iddomaine',  $domaineliste);
    	$domaines->setLabel('Domaine ')	;
    	$domaines->setDecorators($decorators);
    	$desc = new Zend_Form_Element_Textarea('description');
    	$desc->setLabel('Description:')
    	->setRequired(true)
    	->setAttrib('COLS', '40')
    	->setAttrib('ROWS', '4');
    	$desc->setDecorators(array('ViewHelper'));
    	$datecreation = new Zend_Form_Element_Text('date_creation');
    	$datecreation->setLabel('Date de création: ')
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty');
    	$datecreation->setDecorators($decorators);
    	
    	$datepublication = new Zend_Form_Element_Text('date_publication');
    	$datepublication->setLabel('Publier le: ')
    	->addFilter('StripTags')
    	->addFilter('StringTrim')
    	->addValidator('NotEmpty');
    	$datepublication->setDecorators($decorators);
    	$activation=new Zend_Form_Element_Radio("activation");
    	$activation->setLabel("Activer : ");
    	 
    	$activation->addMultiOptions(array(
    			 
    			'1' => 'Start',
    			 
    			'0' => 'Stop'
    			 
    	))
    	->setSeparator('');
    	$activation->setDecorators($decorators);
    	 
    	
    	$submit = new Zend_Form_Element_Submit('submit',"Enregistrer");
    	 
    	$this->addElements(array($titre,$domaines,$desc,$datecreation,$datepublication,$activation,$submit));
    	//$this->setDecorators( array( array('ViewScript', array('viewScript' => 'protypeform.phtml'))));
    	
    }


}

